
# 1. 变量 名字 = 值
## 1.1 定义数字变量
ten = 10

## 1.2 定义字符串变量
place = "BaZhuaYuan"
place1 = 'BaZhuaYuan'

## 1.3 定义布尔变量
result = True
result1 = False

## 1.4 列表
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
numbers[0] = 1
numbers[-1] = 9
numbers[-2] = 8
numbers[1:4] = [2, 3, 4, 5]
numbers[3:]  = []
numbers[:8]  = 
numbers[::2] = 
numbers[::-1] = 

len(numbers)

# 2. 从终端获取用户输入
num = input('请输入一个数字')

old = input('数据年龄')

# 从 input 获取的任何内容都是字符串
old = int(old)

#3. 条件分支
if old > 40:
    print("中年人")
elif old <= 40 and old > 20:
    print("青年人")
else:
    print("儿童")
# old 小于等于 40 并且 大于 20，打印青年人

#4. 循环
for i in numbers:
    print(i)

for c in "China":
    print(c)

for i in range(1, 10):
    print(i)


i = 10
while i < 100:
    print(i)
    i += 1

# 5. 函数
def double(n):
    return n * 2

print(double(100))

# 返回 s 中最长的连续的数字的个数
# longestNumber("aabb222c")
# longestNumber("11bb222c3334")

def longestNumber(s):

